|
|
|
| TABLE 19.1. NEW BASIC LANGUAGE FUNCTIONS INCLUDED WITH VISUAL BASIC 6. | | Name | Description | | Filter | Returns a zero-based array containing a subset of the original array based on a specified value | | Replace | Returns a string where a specified substring has been replaced with a new substring wherever it was found | | Round | Returns a number rounded to a specified number of decimal places | | Split | Returns an array containing a specified number of substrings from a single string expression | | StrReverse | Reverses the character order of a specified string | | Join | Returns a string created by joining all the elements in a string array | | WeekdayName | Returns the name of the specified day of the week | | MonthName | Returns the name of the specified month |
|
|
|
|
|
|
In addition to these new functions, there are several new formatting functions that you can use. The name of these functions basically explain their function and are as follows: |
|
|
|
|
|
|
|
|
Avoid Using Variant Variables |
|
|
|
|
|
|
|
|
You should know that the default data type in Visual Basic is Variant. But because Visual Basic converts all Variant types to the appropriate data type at runtime, any operations involving other simple data types will eliminate this extra step and are faster than their Variant equivalents. |
|
|
|
|
|
|
|
|
To avoid Variant data types from being defined for you, you should use the OptionExplicit statement in the application, which forces you to declare all your variables. |
|
|
|
|
|
|
|
|
Use Long Integer Variables and Integer Math |
|
|
|
|
|
|
|
|
If your application performs complex arithmetic operations, you should avoid using Currency, Single, and Double variables. Use Long integer variables whenever you can, particularly in loops; because the Long integer is the 32-bit CPU's native data type, operations that use such integers are very fast. If you can't use Long variables, the Integer or Byte data types are the next best choice. |
|
|
|
|
|